package com.cloud.pet.ops.controller.car;

import com.cloud.commons.Result;
import com.cloud.commons.utils.FastJsonUtils;
import com.cloud.pet.api.manager.system.SystemManager;
import com.cloud.pet.api.resp.system.SysParamVo;
import com.cloud.pet.ops.controller.BaseContoller;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Objects;

/**
 * description: 获取系统参数
 * Author   Date    Changes
 * tc  2020/01/05 Created
 */
@RestController
@Slf4j
@Api(tags = "获取系统参数")
@RequestMapping("car")
public class CommonController extends BaseContoller {

    @Resource
    private SystemManager systemManager;

    /** 获取系统参数    **/
    @PostMapping(value = "/querySysParamByKey")
    public Result querySysParamByKey(@RequestBody SysParamVo sysParamVo){
        log.info("获取系统参数 - carLocus - begin，queryCarRunLogVo={}", FastJsonUtils.toJSONNoFeatures(sysParamVo));
        if (Objects.isNull(sysParamVo.getKey())) {
            return Result.build(-1, "必填参数不能为空");
        }
        return systemManager.querySysParamByKey(sysParamVo) ;
    }

}
